/*
 * @Author: szx
 * @Date: 2021-11-08 16:09:27
 * @LastEditTime: 2021-11-08 16:09:29
 * @Description:
 * @FilePath: \leetcode\1-99\74\74.go
 */
package main

import "sort"

func searchMatrix(matrix [][]int, target int) bool {
	row := sort.Search(len(matrix), func(i int) bool { return matrix[i][0] > target }) - 1
	if row < 0 {
		return false
	}
	col := sort.SearchInts(matrix[row], target)
	return col < len(matrix[row]) && matrix[row][col] == target
}
